package org.alex.samples.model;

import java.io.Serializable;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;

@Entity
@Table(name = "exam_user_subject")
public class ExamUserSub implements Serializable {

	private static final long serialVersionUID = 7546524693578195492L;
	
	@Id
	@Column(name="user_id",nullable = false)
	private String userId;
	
	@Id
	@Column(name="sub_id",nullable = false)
	private Integer subId;
	
	@ManyToOne(cascade = {CascadeType.DETACH,CascadeType.PERSIST,CascadeType.MERGE})
	@JoinColumn(name = "user_id")
	private User user;
	
	@ManyToOne(cascade = {CascadeType.DETACH,CascadeType.PERSIST,CascadeType.MERGE})
	@JoinColumn(name = "sub_id")
	private Sub sub;
	
	public ExamUserSub(){
		super();
	}
	public ExamUserSub(String userId,Integer subId,User user,Sub sub){
		super();
		this.userId=userId;
		this.subId=subId;
		this.user=user;
		this.sub=sub;
	}

	public String getUserId() {
		return userId;
	}

	public void setUserId(String userId) {
		this.userId = userId;
	}

	public Integer getSubId() {
		return subId;
	}

	public void setSubId(Integer subId) {
		this.subId = subId;
	}

	public User getUser() {
		return user;
	}

	public void setUser(User user) {
		this.user = user;
	}

	public Sub getSub() {
		return sub;
	}

	public void setSub(Sub sub) {
		this.sub = sub;
	}

}
